/*
 * @Author: Zeratul
 * @Date: 2020-08-21 16:47:36
 * @LastEditTime: 2020-08-24 14:38:43
 * @FilePath: \sz-h5-2003-react-mobile\zhangminhui\eleme-react\eleme-user\src\utils\myaxios.js
 */

import axios from "axios"
import qs from 'qs'
const instance = axios.create({
    baseURL: process.env.REACT_APP_URL,
});
instance.interceptors.request.use(function (config) {
    axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded';
    config.data = qs.stringify(config.data);
    return config;
  }, function (error) {
    return Promise.reject(error);
  });

instance.interceptors.response.use(function (response) {
    return response.data;
  }, function (error) {
    return Promise.reject(error);
  });
  export default instance